Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add map() to the DSL #687

Merged
merged 6 commits into from
Jan 20, 2019
Merged

Add map() to the DSL #687

merged 6 commits into from
Jan 20, 2019

Conversation

wlandau
Copy link
Member

@wlandau wlandau commented Jan 20, 2019

Summary

library(drake)
plan <- drake_plan(
  data = target(
    simulate(data, nrows),
    transform = map(data = c(mtcars, "iris"), nrows = c(48, 64))
  ),
  analysis = target(analyze(data), transform = reduce())
)
plan
#> # A tibble: 3 x 2
#>   target        command                                                    
#>   <chr>         <chr>                                                      
#> 1 data_mtcars_… simulate(mtcars, 48)                                       
#> 2 data_.iris._… "simulate(\"iris\", 64)"                                   
#> 3 analysis      analyze(list(data_mtcars_48 = data_mtcars_48, data_.iris._…

drake_plan_source(plan)
#> drake_plan(
#>   data_mtcars_48 = simulate(mtcars, 48),
#>   data_.iris._64 = simulate("iris", 64),
#>   analysis = analyze(list(data_mtcars_48 = data_mtcars_48, data_.iris._64 = data_.iris._64))
#> )

Created on 2019-01-19 by the reprex package (v0.2.1)

cc @AlexAxthelm re #235 (comment). Fixes #233.

This is a better solution than map_plan() because the DSL lets you work entirely in drake_plan().

Related GitHub issues and pull requests

Checklist

  • I have read drake's code of conduct, and I agree to follow its rules.
  • I have listed any substantial changes in the development news.
  • I have added testthat unit tests to tests/testthat to confirm that any new features or functionality work correctly.
  • I have tested this pull request locally with devtools::check()
  • This pull request is ready for review.
  • I think this pull request is ready to merge.

@wlandau wlandau self-assigned this Jan 20, 2019
@codecov-io
Copy link

codecov-io commented Jan 20, 2019

Codecov Report

Merging #687 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #687   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          72     72           
  Lines        5694   5705   +11     
=====================================
+ Hits         5694   5705   +11
Impacted Files Coverage Δ
R/api-plan.R 100% <ø> (ø) ⬆️
R/api-dsl.R 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf92010...e2f4649. Read the comment docs.

@wlandau wlandau merged commit 7493bd3 into master Jan 20, 2019
@wlandau wlandau deleted the 233 branch January 20, 2019 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants